function showIllegalInformConfigurationSearch(){
	window.location.href="showIllegalInformConfigurationSearch.do";
}

function ajaxFindIllegalInformConfigurationSearchList(currentPage,pageSize) {
	$.ajax({
		type:"post",
		url: "ajaxIllegalInformConfigurationSearchList.do",
		data:{
			groupname:$("#txtIICroupName").val(),
			currentPage:currentPage,
			pageSize:pageSize,
			orderBy:"id",
		},
		success:function(msg){
			$("#listIllegalInformConfigurationBox").html(msg);
		}
	});
}

function ajaxShowIllegalInformConfigurationEdit(id){
	$.ajax({
		type:"post",
		url:"ajaxShowIllegalInformConfigurationEdit.do",
		data:{illegalInformConfigurationId:id},
		success:function(msg){
			$("#dialog2").html(msg);
			$("#dialog2").dialog({
				autoOpen: true,
				width: 800,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [{
					text : "保存",
					click : function() {
						ajaxSaveIllegalInformConfiguration(this);
					}
				}, {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				}]
			});
		}
	});
}

function ajaxSaveIllegalInformConfiguration(objDialog) {
	illegalInformConfigurationValidate();
	if ($("#frmIllegalInformConfiguration").valid()) {
		$(objDialog).dialog("close");
		var options ={
				type: "post",
				url : "ajaxSaveIllegalInformConfiguration.do",
				success: function () {
					clearInput("#sltIllegalInformConfiguration");
					ajaxFindIllegalInformConfigurationSearchList(1);
					showMessageDialog("保存机动车所有人违法告知配置","机动车所有人违法告知配置保存成功。",null,dialogType.info);
				}
		};
		var i = 0;
		$("#vehicleDialog tbody input[type='hidden']").each(
				function () {$(this).attr("name","illegalVehicleInfoList["+ i++ +"].id");}
		);
		$("#frmIllegalInformConfiguration").ajaxSubmit(options);
	}
}

function ajaxShowIllegalInformConfigurationView(id){
	$.ajax({
		type:"post",
		url:"ajaxShowIllegalInformConfigurationView.do",
		data:{id:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 650,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [ {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				} ]
			});
		}
	});
}

function ajaxDeleteIllegalInformConfigurationById(id) {
	var illegalInformConfigurationIds="";
	var sltIIC = $("#listIllegalInformConfigurationList tbody input:checked").length;
	if(id==null){
		$("#listIllegalInformConfigurationList tbody input:checked").each(function(){ 
			illegalInformConfigurationIds += $(this).val()+";";
		});
		if (illegalInformConfigurationIds == ""){
			showMessageDialog("提示","请选择一行或多行",null,dialogType.info);
			return;
		}else{
			illegalInformConfigurationIds=illegalInformConfigurationIds.substring(0, illegalInformConfigurationIds.length-1);
		}
	}else{
		illegalInformConfigurationIds=id;
		sltIIC = 1;
	}
	if (illegalInformConfigurationIds!=null) {
		showMessageDialog("删除机动车所有人违法告知配置","确定要删除所选“"+sltIIC+"”条机动车所有人违法告知配置吗？",
				function () {
			$.ajax({					
				type:"post",
				url:"ajaxDeleteIllegalInformConfigurationByIds.do",
				data:{illegalInformConfigurationIds:illegalInformConfigurationIds},
				success:function(msg){
					ajaxFindIllegalInformConfigurationSearchList();
					showMessageDialog("提示","机动车所有人违法告知配置删除成功",null,dialogType.info);
				}
			});}
		,dialogType.warning);
	} 
}

function illegalInformProcessDialogView(){
	$("#illegalInformProcessDialogView").dialog({
		autoOpen: true,
		width: 650,
		modal: true,
		buttons : [ {
			text : "关闭",
			click : function() {
				$(this).dialog("close");
			}
		} ]
	});
}

function illegalActionTypeDialogView(){
	$("#illegalActionTypeDialogView").dialog({
		autoOpen: true,
		width: 650,
		modal: true,
		buttons : [ {
			text : "关闭",
			click : function() {
				$(this).dialog("close");
			}
		} ]
	});
}

function illegalInformRuleDialogView(){
	$("#illegalInformRuleDialogView").dialog({
		autoOpen: true,
		width: 650,
		modal: true,
		buttons : [ {
			text : "关闭",
			click : function() {
				$(this).dialog("close");
			}
		} ]
	});
}

function illegalLocationDialogView(){
	$("#illegalLocationDialogView").dialog({
		autoOpen: true,
		width: 650,
		modal: true,
		buttons : [ {
			text : "关闭",
			click : function() {
				$(this).dialog("close");
			}
		} ]
	});
}

function getDialogRightForString(rightId,hiddenInputId) {
	var value="";
	var tmp="";
	$('#'+rightId+' tbody tr').each(function(){
		tmp = $(this).attr('id');
		value+=tmp.substring(6, tmp.length)+",";
	});
	value=value.substring(0,value.length-1);
	$("#" +hiddenInputId).val(value);
}
